#include <iostream>
using namespace std;

class Animal
{
public:
	Animal(int _age):age(_age)
	{
		weight=5.6;
		cout<<"构造函数的参数列表"<<endl;
	}
	
	int setWeight() const  //注意const修饰成员方法，const写在后面
	{
		cout<<"setWeight"<<endl;
	}
	void show()
	{
		cout<<"age:  "<<age<<endl;
	}
private:
	const int age;
	float weight;
	string name;
};

int main()
{
	//定义一个常对象
	const Animal a(8);
	//a.show();  错误的,常对象只能调用const修饰的方法
	a.setWeight();
}
